Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@cross2d/classer
Advanced tools
Classer is a tool from Code Hike
A little package to make React component libraries interoperable with most styling solutions. (See this twitter thread explaining why this is useful)
You write your library code like this:
// foo-library code
import { useClasser } from "@cross2d/classer"
export function Foo({ classes }) {
const c = useClasser("foo", classes)
return (
<div className={c("container")}>
<h1 className={c("title")}>Hello</h1>
<p className={c("description")}>World</p>
<img
className={c("img")}
src="https://placekitten.com/200/200"
/>
</div>
)
}
And the library consumers use it like this in their apps:
import { Foo } from "foo-library"
const classes = {
"foo-title": "my-app-blue",
"foo-img": "rounded-corners some-border",
}
function MyApp() {
return <Foo classes={classes} />
}
MyApp
renders this HTML:
<div class="foo-container">
<h1 class="foo-title my-app-blue">Hello</h1>
<p class="foo-description">World</p>
<img
class="foo-img rounded-corners some-border"
src="https://placekitten.com/200/200"
/>
</div>
Examples:
You can also do this (to avoid passing classes
to nested components):
// foo-library code
import {
useClasser,
ClasserProvider,
} from "@cross2d/classer"
export function Foo({ classes }) {
return (
<ClasserProvider classes={classes}>
<FirstChild />
<SecondChild />
</ClasserProvider>
)
}
function FirstChild() {
const c = useClasser("foo-first")
return <h1 className={c("title")}>Hi</h1>
}
function SecondChild() {
const c = useClasser("foo-second")
return <h1 className={c("title")}>Ho</h1>
}
import { Foo } from "./foo-library"
import styles from "./app.module.css"
const classes = {
"foo-title": styles.myTitle,
"foo-img": styles.myImage,
}
function MyApp() {
return <Foo classes={classes} />
}
MIT
FAQs
> Classer is a tool from [Code Hike](https://codehike.org)
We found that @cross2d/classer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.